#ifndef FILEBASED_H
#define FILEBASED_H

#include "earthquake_global.h"

#include <string>
using namespace std;

class FileBased
{
public:
    FileBased();

    // interfaccia virtuale pura
    virtual ExaFileErr fileSave (const string& file_name) const = 0;
    virtual ExaFileErr fileOpen (const string& file_name)       = 0;
    virtual ExaFileObj  fileObj ( void )                  const = 0;

    virtual string    fileExt (
            ExaFileFormat f = EXA_FILE_FORMAT_CURRENT,
            ExaVersion v = EXA_VER_CURRENT
            ) const;

    virtual quint32 fileMagic (
            ExaFileFormat f = EXA_FILE_FORMAT_CURRENT,
            ExaVersion v = EXA_VER_CURRENT
            ) const;

    string  fileObjDescriptor ( void ) const;

    // setta o restituisce il formato file della classe;
    static ExaFileFormat fileFormat ( void );
    static          void fileFormat ( ExaFileFormat f );

    // setta o restituisce la versione corrente;
    static ExaVersion fileVersion ( void );
    static       void fileVersion ( ExaVersion v );

    // setta o restituisce il formato file della classe;
    static void fileReset ( void );
protected:
    ExaFileErr fileControl (const string& file_name, ExaFileOpenMode om) const;

private:
   static ExaFileFormat m_file_format;
   static    ExaVersion m_version;
};

#endif // FILEBASED_H
